/*
 * @Author: 黄达全
 * @Date: 2024-08-09 16:28:21
 * @LastEditTime: 2024-08-16 18:59:54
 */
import axios from "../index"
import type { RoleApi, ApiResponse ,RoleXiaLaVO,RoleSelectVOList} from "@/common/type"


export default {
    //获取下拉列表的角色信息
    async selectXiaLa() {
        return (await axios.get("/admin/role")).data as ApiResponse<RoleXiaLaVO[]>
    },
    //获取角色列表
    async selectByPage(page,pageSize){
        return (await axios.get(`/admin/role/${page}?pageSize=${pageSize}`)).data as ApiResponse<RoleSelectVOList>
    },
    //添加角色
    async add(form){
        return (await axios.post("/admin/role",form)).data as ApiResponse<any>
    },
    //删除角色
    async delete(ids){
        const queryString = ids.map(id => `ids=${id}`).join('&');  
        return (await axios.delete(`/admin/role?${queryString}`)).data as ApiResponse<any>
    },
    //修改角色
    async update(form){
        return (await axios.put("/admin/role",form)).data as ApiResponse<any>
    }

} as RoleApi